/**
 * This is a class to display all good info
 */
import java.util.Random;

/**
 * @author Master
 * @version $Revision: 1.0 $
 */
public class GoodInfo{
	/**
	 * Field LINGDIANBA.
	 * (value is 0.8)
	 */
	private static final double LINGDIANBA = 0.8;
	
	/**
	 * Field YIDIANER.
	 * (value is 1.2)
	 */
	private static final double YIDIANER = 1.2;
	
	/**
	 * Field SIBAIER.
	 * (value is 420)
	 */
	private static final int SIBAIER = 420;

	/**
	 * Field SANQIAN.
	 * (value is 3000)
	 */
	private static final int SANQIAN = 3000;

	/**
	 * Field BABAI.
	 * (value is 800)
	 */
	private static final int BABAI = 800;

	/**
	 * Field ERBAIQI.
	 * (value is 270)
	 */
	private static final int ERBAIQI = 270;

	/**
	 * Field QIBAI.
	 * (value is 700)
	 */
	private static final int QIBAI = 700;

	/**
	 * Field WUSHI.
	 * (value is 50)
	 */
	private static final int WUSHI = 50;

	/**
	 * Field YIQIANYI.
	 * (value is 1100)
	 */
	private static final int YIQIANYI = 1100;

	/**
	 * Field LIUBAI.
	 * (value is 600)
	 */
	private static final int LIUBAI = 600;

	/**
	 * Field SHISAN.
	 * (value is 13)
	 */
	private static final int SHISAN = 13;

	/**
	 * Field SHIER.
	 * (value is 12)
	 */
	private static final int SHIER = 12;

	/**
	 * Field LIANGQIAN.
	 * (value is 2000)
	 */
	private static final int LIANGQIAN = 2000;

	/**
	 * Field JIUSHI.
	 * (value is 90)
	 */
	private static final int JIUSHI = 90;

	/**
	 * Field SHISI.
	 * (value is 14)
	 */
	private static final int SHISIA = 14;

	/**
	 * Field SIBAI.
	 * (value is 400)
	 */
	private static final int SIBAI = 400;

	/**
	 * Field ERBAISAN.
	 * (value is 230)
	 */
	private static final int ERBAISAN = 230;

	/**
	 * Field JIU.
	 * (value is 9)
	 */
	private static final int JIU = 9;

	/**
	 * Field YIBAIERSHIWU.
	 * (value is 125)
	 */
	private static final int YIBAIERSHIWU = 125;

	/**
	 * Field ERBAIWU.
	 * (value is 250)
	 */
	private static final int ERBAIWU = 250;

	/**
	 * Field ERBAIBA.
	 * (value is 280)
	 */
	private static final int ERBAIBA = 280;

	/**
	 * Field YIBAILIU.
	 * (value is 160)
	 */
	private static final int YIBAILIU = 160;

	/**
	 * Field SHIWU.
	 * (value is 15)
	 */
	private static final int SHIWU = 15;

	/**
	 * Field QISHIWU.
	 * (value is 75)
	 */
	private static final int QISHIWU = 75;

	/**
	 * Field LIUBAIQU.
	 * (value is 650)
	 */
	private static final int LIUBAIQU = 650;

	/**
	 * Field SHIYI.
	 * (value is 11)
	 */
	private static final int SHIYI = 11;

	/**
	 * Field ERSHI.
	 * (value is 20)
	 */
	private static final int ERSHI = 20;

	/**
	 * Field WUQIAN.
	 * (value is 5000)
	 */
	private static final int WUQIAN = 5000;

	/**
	 * Field QI.
	 * (value is 7)
	 */
	private static final int QI = 7;

	/**
	 * Field SANSHI.
	 * (value is 30)
	 */
	private static final int SANSHI = 30;

	/**
	 * Field SANQIANWU.
	 * (value is 3500)
	 */
	private static final int SANQIANWU = 3500;

	/**
	 * Field BA.
	 * (value is 8)
	 */
	private static final int BA = 8;

	/**
	 * Field JIUBAI.
	 * (value is 900)
	 */
	private static final int JIUBAI = 900;

	/**
	 * Field SANBAIWU.
	 * (value is 350)
	 */
	private static final int SANBAIWU = 350;
	
	/**
	 * Field YIQIANLIANGBAIWU.
	 * (value is 1250)
	 */
	private static final int YIQIANLIANGBAIWU = 1250;

	/**
	 * Field YIBAIWU.
	 * (value is 150)
	 */
	private static final int YIBAIWU = 150;

	/**
	 * Field SHI.
	 * (value is 10)
	 */
	private static final int SHI = 10;

	/**
	 * Field YIBAI.
	 * (value is 100)
	 */
	private static final int YIBAI = 100;

	/**
	 * Field ER.
	 * (value is 2)
	 */
	private static final int ER = 2;

	/**
	 * Field SI.
	 * (value is 4)
	 */
	private static final int SI = 4;

	/**
	 * Field WU.
	 * (value is 5)
	 */
	private static final int WU = 5;

	/**
	 * Field SAN.
	 * (value is 3)
	 */
	private static final int SAN = 3;

	/**
	 * Field LIU.
	 * (value is 6)
	 */
	private static final int LIU = 6;

	/**
	 * Method toString.
	
	 * @return String */
	@Override
	public String toString() {
		return "GoodInfo []";
	}
	
	/**
	 * Field GoodName.
	 */
	public static String[]GoodName={
		"WATER",
		"FURS",
		"FOOD",
		"ORE",
		"GAMES",
		"FIREARMS",
		"MEDICINE",
		"MACHINES",
		"NARCOTICS",
		"ROTOTS",
	};
	
	/**
	 * Field MTLP.
	 */
	public static int[]MTLP={0, 0, 1, ER, SAN, SAN, SI, SI, WU, LIU};
	
	/**
	 * Field MTLU.
	 */
	public static int[]MTLU={0, 0, 0, ER, 1, 1, 1, SAN, 0, SI};
	
	/**
	 * Method getGoodName.
	
	 * @return String[] */
	public static String[] getGoodName() {
		return GoodName;
	}
	
	/**
	 * Method setGoodName.
	 * @param goodName String[]
	 */
	public static void setGoodName(String[] goodName) {
		GoodName = goodName.clone();
	}
	
	/**
	 * Method getMTLP.
	
	 * @return int[] */
	public static int[] getMTLP() {
		return MTLP;
	}
	
	/**
	 * Method setMTLP.
	 * @param mTLP int[]
	 */
	public static void setMTLP(int[] mTLP) {
		MTLP = mTLP.clone();
	}
	
	/**
	 * Method getMTLU.
	
	 * @return int[] */
	public static int[] getMTLU() {
		return MTLU;
	}
	
	/**
	 * Method setMTLU.
	 * @param mTLU int[]
	 */
	public static void setMTLU(int[] mTLU) {
		MTLU = mTLU.clone();
	}
	
	/**
	 * Method getVAR.
	
	 * @return int[] */
	public static int[] getVAR() {
		return VAR;
	}
	
	/**
	 * Method setVAR.
	 * @param vAR int[]
	 */
	public static void setVAR(int[] vAR) {
		VAR = vAR.clone();
	}
	
	/**
	 * Method getBASEPRICE.
	
	 * @return int[] */
	public static int[] getBASEPRICE() {
		return BASEPRICE;
	}
	
	/**
	 * Method setBASEPRICE.
	 * @param bASEPRICE int[]
	 */
	public static void setBASEPRICE(int[] bASEPRICE) {
		BASEPRICE = bASEPRICE.clone();
	}
	
	/**
	 * Method getIPL.
	
	 * @return int[] */
	public static int[] getIPL() {
		return IPL;
	}
	
	/**
	 * Method setIPL.
	 * @param iPL int[]
	 */
	public static void setIPL(int[] iPL) {
		IPL = iPL.clone();
	}
	
	/**
	 * Method getIE.
	
	 * @return int[] */
	public static int[] getIE() {
		return IE;
	}
	
	/**
	 * Method setIE.
	 * @param iE int[]
	 */
	public static void setIE(int[] iE) {
		IE = iE.clone();
	}
	
	/**
	 * Method getCR.
	
	 * @return int[] */
	public static int[] getCR() {
		return CR;
	}
	
	/**
	 * Method setCR.
	 * @param cR int[]
	 */
	public static void setCR(int[] cR) {
		CR = cR.clone();
	}
	
	/**
	 * Method getMTL.
	
	 * @return int[] */
	public static int[] getMTL() {
		return MTL;
	}
	
	/**
	 * Method setMTL.
	 * @param mTL int[]
	 */
	public static void setMTL(int[] mTL) {
		MTL = mTL.clone();
	}
	
	/**
	 * Method getMTH.
	
	 * @return int[] */
	public static int[] getMTH() {
		return MTH;
	}
	
	/**
	 * Method setMTH.
	 * @param mTH int[]
	 */
	public static void setMTH(int[] mTH) {
		MTH = mTH.clone();
	}
	
	/**
	 * Method getMODELEDPRICE.
	
	 * @return int[] */
	public static int[] getMODELEDPRICE() {
		return MODELEDPRICE;
	}
	
	/**
	 * Method setMODELEDPRICE.
	 * @param mODELEDPRICE int[]
	 */
	public static void setMODELEDPRICE(int[] mODELEDPRICE) {
		MODELEDPRICE = mODELEDPRICE.clone();
	}
	
	/**
	 * Method getRandom.
	
	 * @return Random */
	public static Random getRandom() {
		return Rand;
	}
	
	/**
	 * Method setRandom.
	 * @param random Random
	 */
	public static void setRandom(Random random) {
		GoodInfo.Rand = random;
	}
	
	/**
	 * Field VAR.
	 */
	public static int[]VAR={SI, SHI, WU, SHI, WU, YIBAI, SHI, WU, YIBAIWU, YIBAI};
	
	/**
	 * Field BASEPRICE.
	 */
	public static int[]BASEPRICE={SANSHI, ERBAIWU, YIBAI, SANBAIWU, 
		ERBAIWU, YIQIANLIANGBAIWU, LIUBAIQU, JIUBAI, SANQIANWU, WUQIAN};
	
	/**
	 * Field IPL.
	 */
	public static int[]IPL={SAN, SHI, WU, ERSHI, -SHI, -QISHIWU, 
		-ERSHI, -SANSHI, -YIBAIERSHIWU, -YIBAIWU};
	
	/**
	 * Field IE.
	 */
	public static int[]IE={1, ER, SAN, SI, WU, SI, LIU, QI, WU, QI};
	
	/**
	 * Field CR.
	 */
	public static int[]CR={BA, JIU, SHI, SHIYI, SHIER, SHISAN, SHISIA, -1, SHIWU, -1};
	
	/**
	 * Field MTL.
	 */
	public static int[]MTL={SANSHI, ERBAISAN, JIUSHI, SANBAIWU, 
		YIBAILIU, LIUBAI, SIBAI, LIUBAI, LIANGQIAN, SANQIANWU};
	
	/**
	 * Field MTH.
	 */
	public static int[]MTH={WUSHI, ERBAIBA, YIBAILIU, 
		SIBAIER, ERBAIQI, YIQIANYI, QIBAI, BABAI, SANQIAN, WUQIAN};
	
	/**
	 * Field MODELEDPRICE.
	 */
	public static int[]MODELEDPRICE={};
	
	/**
	 * Field random.
	 */
	public static Random Rand=new Random();

	/**
	 * Method init.
	 * @param p Planet
	 */
	public static void init(Planet p){
		MODELEDPRICE=new int[SHI];
		int modeledPrice;
		for (int i=0;i < SHI;i++){
			modeledPrice = BASEPRICE[i] + IPL[i] *
						   (p.getSolarSystem().getTechLevel() - MTLP[i]) + 
						   BASEPRICE[i] * (p.getPlanetVar(i) / YIBAI);
		    MODELEDPRICE[i]=modeledPrice;
		    if (GameInfo.Rand.nextInt(YIBAI) > JIUSHI){
		    	if (MODELEDPRICE[i] > MTH[i] || MODELEDPRICE[i] < MTL[i]) {
		    		MODELEDPRICE[i] = GameInfo.Rand.nextInt(MTH[i] - MTL[i]) + MTL[i];
		    	}
		    }
		    if (p.getSpecialConditionNo() == IE[i]) {
		    	MODELEDPRICE[i] = (int) (MODELEDPRICE[i] * LINGDIANBA);
		    }
		    if (p.getSpecialConditionNo() == CR[i]) {
		    	MODELEDPRICE[i] = (int) (MODELEDPRICE[i] * YIDIANER);
		    }
		}
	}
	
	/**
	 * Method getName.
	
	 * @return String[] */
	public static String[] getName(){
		return GoodName;
	}
	
	/**
	 * Method getMP.
	
	 * @return int[] */
	public static int[] getMP(){
		return MTLP;
	}
	
	/**
	 * Method getMU.
	
	 * @return int[] */
	public static int[]getMU(){
		return MTLU;
	}
	
	/**
	 * Method getBP.
	
	 * @return int[] */
	public static int[]getBP(){
		return BASEPRICE;
	}
}
